package cate.game.videohall.vo;

import cate.game.role.RoleSnapshot;
import cate.game.role.show.frame.HeadFrameVO;
import cate.game.role.show.icon.HeadIconVO;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@NoteClass("简化的玩家快照")
public class RoleSnapShotSimpleVO {

    @NoteField(value = "主角的唯一ID")
    public String uid;

    @NoteField("名字")
    public String name;

    @NoteField(value = "角色头像")
    public HeadIconVO headIcon;

    @NoteField("头像框")
    public HeadFrameVO headFrame;

    @NoteField("区服ID")
    public int srvId;

    @NoteField("战力")
    public long power;

    @NoteField("等级")
    public int level;

    @NoteField(value = "性别")
    public byte sex;

    public RoleSnapShotSimpleVO(RoleSnapshot snapshot) {
        this.uid = snapshot.uid;
        this.name = snapshot.base.name;
        this.headIcon = snapshot.base.headIcon;
        this.headFrame = snapshot.base.headFrame;
        this.srvId = snapshot.base.srvId;
        this.power = snapshot.base.power;
        this.level = snapshot.base.level;
        this.sex = snapshot.base.sex;
    }

    public RoleSnapShotSimpleVO read(RoleSnapshot snapshot) {
        this.uid = snapshot.uid;
        this.name = snapshot.base.name;
        this.headIcon = snapshot.base.headIcon != null ? snapshot.base.headIcon.copy() : null;
        this.headFrame = snapshot.base.headFrame != null ? snapshot.base.headFrame.copy() : null;
        this.srvId = snapshot.base.srvId;
        this.power = snapshot.base.power;
        this.level = snapshot.base.level;
        this.sex = snapshot.base.sex;
        return this;
    }
}
